<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.wxtf.platform.plugins.user.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
UserBean user = (UserBean)request.getSession().getAttribute("userBean");

String _db = user.getDbType();
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<base href="<%=basePath%>"/>
		<meta http-equiv="pragma" content="no-cache"/>
		<meta http-equiv="cache-control" content="no-cache"/>
		<meta http-equiv="expires" content="0"/>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	
		<link type="text/css" rel="stylesheet" href="ligerUI/skins/Aqua/css/ligerui-all.css" />
		<link type="text/css" rel="stylesheet" href="ligerUI/skins/<%=user.getUserCss()%>/css/ligerui-all.css" />
		<link type="text/css" rel="stylesheet" href="ligerUI/skins/ligerui-icons.css" />
		<link type="text/css" rel="stylesheet" href="resource/css/style.css" />
		<style type="text/css">
		body{
			overflow: scroll;
		}
		#baobiao{
			background-color:#EAEEF5;
		}
		#baobiao_table{
			border:1px #222222 solid;
			border-collapse:collapse;
		}
		#baobiao_table td{
			margin:0px;
			padding:0px;
			border:1px #222222 solid;
			font-size:14px;
			text-align:center;
		}
		#baobiao_table thead td{
			color:#3893CC;
			font-weight: bold;
		}
		#baobiao_table tbody td{
			height:27px;
		}
		#baobiao_table tfoot td{
			text-align:left;
			padding-left:5px;
		}
		#col_num_tr td{
			height:40px;
		}
		#baobiao_table #date_td{
			text-align:right;
		}

		#baobiao_table #title_td{
			font-size:18px;
			font-weight:700;
		}
		#baobiao_table .comname_td{
			text-align:left;
			!font-size:12px;
		}
		#baobiao_table .children_td{
			text-align:right;
			font-size:13px;
			padding-right:2px;
		}
		#baobiao_table #year,#month,#day{
			width:35px;
			text-align:center;
		}
		.table_input{
			padding:0px;
			margin:0px;
			width:92%;
			font-size:13px;
			background:none;
			border:1px #EAEEF5 solid;
			text-align:right;
		}
		
		.otr_input{
			font-size:13px;
			font-weight:100;
			background:#EAEEF5;
		}
		
		.detail_link{
			text-decoration:none;
			color:#000000;
		}
		
		.detail_link:hover{
			text-decoration:none;
			color:#4fa8e6;
		}
	    </style>
	
		<script type="text/javascript" src="js/jquery/jquery-1.7.2.js"></script>
		<script type="text/javascript" src="ligerUI/js/core/base.js"></script>
		<script type="text/javascript" src="ligerUI/js/ligerui.min.js"></script>
		<script type="text/javascript" src="js/common.js"></script>
		<script type="text/javascript" src="js/validata.js"></script>

		<script type="text/javascript" src="ligerUI/js/plugins/ligerGrid.js"></script>
		<script type="text/javascript" src="ligerUI/js/plugins/ligerTree.js"></script>
		<script type="text/javascript" src="ligerUI/js/plugins/ligerForm.js"></script>
		<script type="text/javascript" src="ligerUI/js/plugins/ligerDateEditor.js"></script>
	
		<script type="text/javascript">
			var _db = '<%=_db%>';
			_jsonObj.classname = "com.wxtf.platform.main.jcqkgl.jcqkgl_tognjiAction";
			_jsonObj.methodname = "";
			_jsonObj.logicdata = "[]";

			var _dataTotal = 0;
			$(function(){
				var d = new Date()
				$("#year").val(d.getFullYear());
				$("#month").val(d.getMonth()+1);
				$("#day").val(d.getDate());
				callserver(_jsonObj, function(data, textStatus){
					if(data.Total > 0){
						_dataTotal = data.Total;
						var row;
						for(var i = 0 ; i < data.Total ; i++){
							row = data.Rows[i];
							var tr = '<tr><td>' + (i + 1) + '</td>';
							if(row.children.Total > 0){
								tr = tr + '<td class="comname_td"><a href="javascript:" class="children_btn" id="comid_' + i + '">' + row.name1 + '</a><input type="hidden" id="name1" name="name1" value="' + row.name1 + '"/></td>';
							}else{
								tr = tr + '<td class="comname_td">' + row.name1 + '<input type="hidden" id="name1" name="name1" value="' + row.name1 + '"/></td>';
							}
							tr = tr + '<td><a target="_blank" href="jsp/jcqkgl/tongji_family.jsp?type=only&orgid='+row.orgid+'&time1='+row.time1+'&time2='+row.time2+'" class="detail_link">' + row.name2 + '</a><input type="hidden" id="' + i + '_name2" name="name2" class="table_input textbg1" value="' + row.name2 + '" validate="{required:true,digits:true,maxlength:6}"/></td>'
								+ '<td>' + row.name3 + '</td>'
								+ '<td><a target="_blank" href="jsp/jcqkgl/tongji_family.jsp?type=exceeds&orgid='+row.orgid+'&time1='+row.time1+'&time2='+row.time2+'" class="detail_link">' + row.name4 + '</a><input type="hidden" id="' + i + '_name4" name="name4" class="table_input textbg1" value="' + row.name4 + '" validate="{required:true,digits:true,maxlength:6}"/></td>'
								+ '<td>' + row.name5 + '</td>'
								+ '<td><a target="_blank" href="jsp/jcqkgl/tongji_employee.jsp?type=retire&orgid='+row.orgid+'&time1='+row.time1+'&time2='+row.time2+'" class="detail_link">' + row.name6 + '</a><input type="hidden" id="' + i + '_name6" name="name6" class="table_input textbg1" value="' + row.name6 + '" validate="{required:true,digits:true,maxlength:6}"/></td>'
								+ '<td>' + row.name7 + '</td>'
							+ '</tr>';
							$("#baobiao_table tbody").append(tr);
							
							if(row.children.Total > 0){
								var childrow;
								for(var j = 0 ; j < row.children.Total ; j++){
									childrow = row.children.Rows[j];
									tr = '<tr class="children_' + i + '" style="display:none;">'
										+ '<td class="children_td">' + (j + 1) + '</td>'
										+ '<td class="children_td comname_td">' + childrow.name1 + '</td>'
										+ '<td class="children_td"><a target="_blank" href="jsp/jcqkgl/tongji_family.jsp?type=only&orgid='+childrow.orgid+'&time1='+childrow.time1+'&time2='+childrow.time2+'" class="detail_link">' + childrow.name2 + '</a></td>'
										+ '<td class="children_td">' + childrow.name3 + '</td>'
										+ '<td class="children_td"><a target="_blank" href="jsp/jcqkgl/tongji_family.jsp?type=exceeds&orgid='+childrow.orgid+'&time1='+childrow.time1+'&time2='+childrow.time2+'" class="detail_link">' + childrow.name4 + '</a></td>'
										+ '<td class="children_td">' + childrow.name5 + '</td>'
										+ '<td class="children_td"><a target="_blank" href="jsp/jcqkgl/tongji_employee.jsp?type=retire&orgid='+childrow.orgid+'&time1='+childrow.time1+'&time2='+childrow.time2+'" class="detail_link">' + childrow.name6 + '</a></td>'
										+ '<td class="children_td">' + childrow.name7 + '</td>'
										$("#baobiao_table tbody").append(tr);
								}
							}
						}
					}else{
						$("#baobiao_table tbody").append('<tr><td colspan="21">暂时没有数据！</td></tr>');
					}
				}, ajaxCallbackErrorFunc);
				
				$("#ser4").ligerDateEditor({ format: "yyyy-MM-dd", width:160});
				$("#ser5").ligerDateEditor({ format: "yyyy-MM-dd", width:160});
				
				$(".children_btn").click(function(){
					var id = $(this).attr("id").split("_")[1];
					$(".children_" + id).toggle();
				});
				
				$("#baobiao_download").click(function(){
					var orgIds = $('#org2').val();
					var time1 = $('#ser4').val();
					var time2 = $('#ser5').val();
					_jsonObj.methodname = "download";
					_jsonObj.logicdata = '[{\"orgIds\":\"' + orgIds + '\",\"time1\":\"' + time1 + '\",\"time2\":\"' + time2+'\"}]';
					callserver(_jsonObj, function(data, textStatus){
						if(data.result){
							downloadFile(data.resultrecord);
						} else {
							warningTip(data.resultrecord);
						}
					}, function(data, textStatus){
					});
				});				
				
            });
            
 
	
            /*
			 * 表格刷新
			 */
			function reload(){
				_jsonObj.methodname = "queryPage";
				_jsonObj.logicdata = "[{\"types\":\"init\"}]";
				manager.loadData();
			}
			
			/*
			 * ajax成功回调
			 */
			function ajaxCallbackSuccFunc(data, textStatus){
				serch1();
				if(data.result || data.result == 'true'){
					succMsgTip(data.resultrecord);
				}else{
					warningTip(data.resultrecord);
				}
			}
			
			/*
			 * ajax失败回调
			 */
			function ajaxCallbackErrorFunc(data, textStatus){
				warningTip(data.resultrecord);
			}			
			
			/*
 * 条件查询
 */
function serch1(){
	var orgIds = $('#org2').val();
	var time1 = $('#ser4').val();
	var time2 = $('#ser5').val();
	
	var theObject=document.getElementById('baobiao_table');
	for(i=6;i<theObject.rows.length;i++)
	{
		theObject.deleteRow(i);
		i--;
	}
	_jsonObj.methodname = "queryPage";
	_jsonObj.logicdata = '[{\"orgIds\":\"' + orgIds+ '\",\"time1\":\"' + time1 + '\",\"time2\":\"' + time2 + '\",\"types\":\"serch1\"}]';
	
	callserver(_jsonObj, function(data, textStatus){
 	if(data.Total > 0){
				_dataTotal = data.Total;
				var row;
				for(var i = 0 ; i < data.Total ; i++){
					row = data.Rows[i];
					var tr = '<tr><td>' + (i + 1) + '</td>';
					if(row.children.Total > 0){
						tr = tr + '<td class="comname_td"><a href="javascript:" class="children_btn" id="comid_' + i + '">' + row.name1 + '</a><input type="hidden" id="name1" name="name1" value="' + row.name1 + '"/></td>';
					}else{
						tr = tr + '<td class="comname_td">' + row.name1 + '<input type="hidden" id="name1" name="name1" value="' + row.name1 + '"/></td>';
					}
					tr = tr + '<td><a target="_blank" href="jsp/jcqkgl/tongji_family.jsp?type=only&orgid='+row.orgid+'&time1='+row.time1+'&time2='+row.time2+'" class="detail_link">' + row.name2 + '</a><input type="hidden" id="' + i + '_name2" name="name2" class="table_input textbg1" value="' + row.name2 + '" validate="{required:true,digits:true,maxlength:6}"/></td>'
						+ '<td><input type="text" readonly="readonly" id="' + i + '_name3" name="name3" class="table_input textbg1" value="' + row.name3 + '" validate="{required:true,digits:true,maxlength:6}"/></td>'
						+ '<td><a target="_blank" href="jsp/jcqkgl/tongji_family.jsp?type=exceeds&orgid='+row.orgid+'&time1='+row.time1+'&time2='+row.time2+'" class="detail_link">' + row.name4 + '</a><input type="hidden" id="' + i + '_name4" name="name4" class="table_input textbg1" value="' + row.name4 + '" validate="{required:true,digits:true,maxlength:6}"/></td>'
						+ '<td><input type="text" readonly="readonly" id="' + i + '_name5" name="name5" class="table_input textbg1" value="' + row.name5 + '" validate="{required:true,digits:true,maxlength:6}"/></td>'
						+ '<td><a target="_blank" href="jsp/jcqkgl/tongji_employee.jsp?type=retired&orgid='+row.orgid+'&time1='+row.time1+'&time2='+row.time2+'" class="detail_link">' + row.name6 + '</a><input type="hidden" id="' + i + '_name6" name="name6" class="table_input textbg1" value="' + row.name6 + '" validate="{required:true,digits:true,maxlength:6}"/></td>'
						+ '<td><input type="text" readonly="readonly" id="' + i + '_name7" name="name7" class="table_input textbg1" value="' + row.name7 + '" validate="{required:true,digits:true,maxlength:6}"/></td>'
						+ '<td><a target="_blank" href="jsp/jcqkgl/tongji_employee.jsp?type=retire&orgid='+row.orgid+'&time1='+row.time1+'&time2='+row.time2+'" class="detail_link">' + row.name8 + '</a><input type="hidden" id="' + i + '_name8" name="name8" class="table_input textbg1" value="' + row.name8 + '" validate="{required:true,digits:true,maxlength:6}"/></td>'
						+ '<td><input type="text" readonly="readonly" id="' + i + '_name9" name="name9" class="table_input textbg1" value="' + row.name9 + '" validate="{required:true,digits:true,maxlength:6}"/></td>'
					+ '</tr>';
					$("#baobiao_table tbody").append(tr);
					
					if(row.children.Total > 0){
								var childrow;
								for(var j = 0 ; j < row.children.Total ; j++){
									childrow = row.children.Rows[j];
									tr = '<tr class="children_' + i + '" style="display:none;">'
									+ '<td class="children_td">' + (j + 1) + '</td>'
									+ '<td class="children_td comname_td">' + childrow.name1 + '</td>'
										+ '<td class="children_td"><a target="_blank" href="jsp/jcqkgl/tongji_family.jsp?type=only&orgid='+childrow.orgid+'&time1='+childrow.time1+'&time2='+childrow.time2+'" class="detail_link">' + childrow.name2 + '</a></td>'
										+ '<td class="children_td">' + childrow.name3 + '</td>'
										+ '<td class="children_td"><a target="_blank" href="jsp/jcqkgl/tongji_family.jsp?type=exceeds&orgid='+childrow.orgid+'&time1='+childrow.time1+'&time2='+childrow.time2+'" class="detail_link">' + childrow.name4 + '</a></td>'
										+ '<td class="children_td">' + childrow.name5 + '</td>'
										+ '<td class="children_td"><a target="_blank" href="jsp/jcqkgl/tongji_employee.jsp?type=retired&orgid='+childrow.orgid+'&time1='+childrow.time1+'&time2='+childrow.time2+'" class="detail_link">' + childrow.name6 + '</a></td>'
										+ '<td class="children_td">' + childrow.name7 + '</td>'
										+ '<td class="children_td"><a target="_blank" href="jsp/jcqkgl/tongji_employee.jsp?type=retire&orgid='+childrow.orgid+'&time1='+childrow.time1+'&time2='+childrow.time2+'" class="detail_link">' + childrow.name8 + '</a></td>'
										+ '<td class="children_td">' + childrow.name9 + '</td>'
										$("#baobiao_table tbody").append(tr);
						}
					}
				}
			}else{
				$("#baobiao_table tbody").append('<tr><td colspan="21">该机构下暂时没有数据！</td></tr>');
			}
		}, ajaxCallbackErrorFunc);
		
		$(".children_btn").click(function(){
			var id = $(this).attr("id").split("_")[1];
			$(".children_" + id).toggle();
		});
}
		</script>
	</head>
  
  	<body>
	  <table id="aaa" class="serTable">
			<tr>
				<td>机构：</td><td><select id="org2" style=" width: 160px;">
						<%=user.getCurSubOrgOptions()%>
					</select>
				</td>
				<td>时间：</td><td><input id="ser4" onkeyup="this.value=formatdata(this.value);"/></td>
				<td>--</td><td><input id="ser5" onkeyup="this.value=formatdata(this.value);"/></td>
				<td><input class="btn2" value="搜索" type="button" onclick="serch1();" /></td>
				<td><input class="btn2" value="导出" id="baobiao_download" type="button" /></td>
			</tr>
		</table>
	    <div id="baobiao" style="margin-left:20px;">
	    	<form id="baobiao_form" name="baobiao_form">
	    	<table id="baobiao_table">
				<thead>
					<tr><td id="title_td" colspan="21" height="40">第一汽车集团公司奖惩情况实时统计表</td></tr>
					<tr><td id="date_td" colspan="21" height="30"><input type="text" id="year" name="year" readonly="readonly" validate="{required:true,digits:true,maxlength:4}" class="otr_input textbg1"/>年<input type="text" id="month" name="month" readonly="readonly" validate="{required:true,digits:true,maxlength:2}" class="otr_input textbg1"/>月<input type="text" id="day" name="day" readonly="readonly" size="2" validate="{required:true,digits:true,maxlength:2}" class="otr_input textbg1"/>日</td></tr>
					<tr>
						<td rowspan="3" width="50">序<br/><br/>号</td>
						<td rowspan="3" width="170">单&nbsp;&nbsp;位</td>
						<td colspan="2">独生子女费</td>
						<td colspan="2">超生缴纳社会<br/>抚养费<br/></td>
						<td colspan="4">退休独生子女父母<br/>奖励费<br/></td>
					</tr>
					<tr>
						<td rowspan="2" width="120">总<br/>人<br/>数</td>
						<td rowspan="2" width="120">总<br/>金<br/>额</td>
						<td rowspan="2" width="120">总<br/>人<br/>数</td>
						<td rowspan="2" width="120">总<br/>金<br/>额</td>
						<td rowspan="2" width="120">已<br/>发<br/>放<br/>人<br/>数</td>
						<td rowspan="2" width="120">已<br/>发<br/>放<br/>金<br/>额</td>
						<td rowspan="2" width="120">应<br/>发<br/>放<br/>人<br/>数</td>
						<td rowspan="2" width="120">应<br/>发<br/>放<br/>金<br/>额</td>
					</tr>
					<tr>
					</tr>
					
					<tr id="col_num_tr"><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>10</td></tr>
				</thead>
				<tbody>
				</tbody>
			</table>
			</form>
			<br/>
	    </div>
	</body>
</html>
